package top.kaoshanji.p2ch17a;

import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;

/**
 * 代码清单-p2ch17a-537页a：文件系统的示例
 * author kaoshanji
 * ^_^
 * create time 2025/3/11 16:22
 */
public class FileSystemDemo {

    static void show(String id, Object o) {
        System.out.println(id + ": " + o);
    }

    public static void main(String[] args) {

        System.out.println(System.getProperty("os.name"));
        FileSystem fileSystem = FileSystems.getDefault();

        for (FileStore fs: fileSystem.getFileStores()) {
            show("File Store", fs);
        }

        for (Path rd: fileSystem.getRootDirectories()) {
            show("Root Directory", rd);
        }

        show("Separator", fileSystem.getSeparator());
        show("UserPrincipalLookupService", fileSystem.getUserPrincipalLookupService());
        show("isOpen", fileSystem.isOpen());
        show("isReadOnly", fileSystem.isReadOnly());
        show("FileSystemProvider", fileSystem.provider());
        show("File Attribute Views", fileSystem.supportedFileAttributeViews());

    }


}
